<script setup lang="ts">
import { useDark } from '@vueuse/core'
import { ConfigProvider } from 'ant-design-vue'
import { computed } from 'vue'
import { RouterView } from 'vue-router'
import { darkTheme, lightTheme } from '@/config/theme'

// 使用 VueUse 自动检测系统主题或手动切换
const isDark = useDark()

// 根据 isDark 动态切换 AntD 主题配置
const themeConfig = computed(() => (isDark.value ? darkTheme : lightTheme))
</script>

<template>
  <ConfigProvider :theme="themeConfig">
    <RouterView />
  </ConfigProvider>
</template>
